A cache is a memory device that logically resides between a device, such as a disk drive, and the remainder of the processor-based system. A cache is a memory device that serves as a temporary storage area for the device, such as the disk drive. Frequently accessed data resides in the cache after an initial access. Subsequent accesses to this same data may be made to the cache instead of to the disk drive. Generally, two types of disk cache are used, write-through cache and write-back cache. Write-through disk cache means that the information is written both to the cache and to the corresponding disk drive. Write-back disk cache means that information is only written to the cache and the corresponding disk drive is subsequently updated when the corresponding cache line is flushed. Write-back is faster than write-through cache but may cause coherency problems since the data in the cache may be different than in the corresponding disk drive until the corresponding cache line is flushed. A cache line of data is dirty if the data in the cache line has been updated by the system but the corresponding disk drive has not been updated. A clean cache line is a line of data in cache that has been flushed (updated) to the corresponding disk drive.
In a processor-based system which supports multiple operating systems such as Windows™, Unix, and Linux, a user may modify data on a cached drive without the corresponding cache being updated, resulting in cache incoherency. For example, a system with a cached drive may be re-booted using a second operating system that does not support disk caching. The cache may not get flushed even though the second operating system may write to the disk drive which would result in disk-cache incoherencies.
Additionally, processor-based system may use write-back disk cache on a disk drive that is removable during the normal operation of the computer. The disk drive may then be installed into another processor-based system which may write to this disk drive. The disk cache and disk drive data may not be coherent if the disk drive is reinstalled into the first system.
Thus, a need exists for alternative ways of implementing a disk cache which can maintain cache-disk coherence.